package Demo_Old.Demo;

import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class CollectionsDemo {

      static <T> T test(T... a){
        System.out.println(a.length);
        System.out.println(a[2]);
        T s = a[0];
        return s;
    }


    public static void main(String[] args) {

//        List<String>[] arrayLists = new ArrayList[10];

//        int a[]=new int[]{1,2,1};
//       test(1,5,8);
       // List<String> list1=new ArrayList<>();
//        ArrayList<Helloword> hellowords = new ArrayList<>();
//        List list=hellowords;

//        List<String> e=list;
//        e.add("444");
//        Helloword helloword = hellowords.get(0);
//        System.out.println(helloword);
//        Vector vector=new Vector();
//        arrayLists[0]=list;
//        arrayLists[0].add("22");
//        String s = arrayLists[0].get(0);
//        System.out.println(s);

//        list.add("55");
//        list.add(2);
//        list.add(new Helloword());
//        Helloword helloword = hellowords.get(0);
//        System.out.println(helloword);
//        System.out.println(hellowords);
      //  Collections.<Father>addAll(list,new Father(),new Helloword());
      //  Object ll = CollectionsDemo.<Comparable>test("ll", 2, 2.1);
//        Comparable<? extends Object> comparable=new Person();

      //  System.out.println(arrayLists[0]);

//        List<String> list=new ArrayList<>();
//        list.add("adoppll");
//        list.add("asd");
//        list.add("hu");
//        list.add("boifg");
//        System.out.println(list);
////        Collections.reverse(list);
////        System.out.println(list);
//        Collections.shuffle(list);//随机排序
//        System.out.println(list);


//        Collections.sort(list, new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                if(o1.length()>o2.length())
//                    return 1;
//                if (o1.length()==o2.length())
//                    return 0;
//                else return -1;
//            }
//        });
//        System.out.println(Collections.binarySearch(list,"adoppll",
//                new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                if(o1.length()>o2.length())
//                    return 1;
//                if (o1.length()==o2.length())
//                    return 0;
//                else return -1;
//            }
//        }));
//        System.out.println(list);
//        Collections.reverse(list);
//        System.out.println(list);

//        List<Helloword> numbers=new ArrayList<>();
//
//        List<? extends Father> number = numbers;
//        Father father = number.get(0);
        List< Integer> numbers1 = Arrays.asList(1, 5);
        Number number1 = numbers1.get(0);
        Object[] objects = numbers1.toArray();
        System.out.println(objects[0]);


    }
}
